﻿@using CubicFWNet.Data.Models
@using CubicFWNet.Data.ViewModal
@model Technology
@{
    var product = ViewBag.Product as Product;
    var prosList = ViewBag.prosList as List<Product>;
    var tmView = ViewBag.TechnologyManageView as TechnologyManageView;
    var proList = ViewBag.ProductList as IEnumerable<Product>;
    var mateList = ViewBag.MaterialList as IEnumerable<Product>;
    var isAdd = ViewBag.IsAdd;
    //var pid = ViewBag.ProductId;
    var listEquipments = ViewBag.ListEquipments as IEnumerable<Equipment>;
    var levelList = ViewBag.LevelList as List<TechType>;
}
<section class="content-header">
    <h1>
        工艺维护
    </h1>
    <ol class="breadcrumb">
        <li><a href="javascript:void(0);"><i class="fa fa-dashboard"></i>@Resources.Global.PageTitle</a></li>
        <li><a href="@Url.Action("Index", "Home")">首页</a></li>
        @*<li class="active"><a href="@Url.Action("ServiceItem", "Technology", new {pId = pid})">工艺维护</a></li>*@
        <li class="active"><a href="@Url.Action("Service", "Technology")">工艺维护</a></li>
    </ol>
</section>
<section class="content">
    <div class="box box-solid">
        <!-- /.box-header -->
        <div class="box-body">
            <div class="row">
                @if (product != null)
                {
                    <form class="form-horizontal" id="frmedit" action="@Url.Action("AddOrUpdateService", "Technology")" method="post">
                        <input type="hidden" id="choseType" name="choseType" value="1" />@*1:主材料 2:辅料*@
                        <input type="hidden" id="isAdd" name="isAdd" value="@isAdd" />
                        <input type="hidden" id="ProductID" name="ProductID" value="@product.Id" />
                        <input type="hidden" id="hidWorkType" value="@product.WorkType" />
                        <div class="box-body">
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">产品名称</label>
                                <div class="col-sm-9">
                                    <div class="col-sm-9" style="padding-top: 7px; margin-bottom: 0;">
                                        <a href="javascript:void(0)" class="productinfo" data-mid="@product.Id">@product.Name</a>
                                    </div>
                                    @*<input type="text" class="form-control" id="ProductName" name="ProductName" value="@product.Name" readonly="readonly">*@
                                </div>
                            </div>
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">产品编号</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="ProductNumber" name="ProductNumber" placeholder="" value="@product.Number" readonly="readonly">
                                </div>
                            </div>
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">尺寸宽-mm</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="SizeWidth" name="SizeWidth" value="@product.SizeWidth">
                                </div>
                            </div>
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">尺寸长-mm</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="SizeLenth" name="SizeLenth" value="@product.SizeLenth">
                                </div>
                            </div>
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">加工方式</label>
                                <div class="col-sm-9">
                                    <select class="form-control" id="WorkType" name="WorkType">
                                        <option value="1">模切</option>
                                        <option value="2">切卷</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">左右间距-mm</label>
                                <div class="col-sm-9">
                                    <input type="text" data-des="左右间距-mm" class="form-control okeydown" value="@product.Space" readonly="readonly">
                                </div>
                            </div>
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">左右边距-mm</label>
                                <div class="col-sm-9">
                                    <input type="text" data-des="左右边距-mm" class="form-control okeydown" value="@product.Margin" readonly="readonly">
                                </div>
                            </div>
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">跳距-mm</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control okeydown" data-des="跳距-mm" value="@product.Distance" readonly="readonly">
                                </div>
                            </div>
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">基本单位</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="Pack" name="Pack" value="@product.Pack" readonly="readonly">
                                </div>
                            </div>
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">特点</label>
                                <div class="col-sm-9">
                                    <textarea rows="3" class="form-control" id="Explain" name="Explain" maxlength="500" readonly="readonly">@product.Explain</textarea>
                                </div>
                            </div>
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">备注</label>
                                <div class="col-sm-9">
                                    <textarea rows="3" class="form-control" id="Memo" name="Memo" maxlength="500" readonly="readonly">@product.Memo</textarea>
                                </div>
                            </div>
                            @*<div class="form-group col-md-6">
                                    <label class="col-sm-3 control-label">规格</label>
                                    <div class="col-sm-9">
                                        <input type="text" class="form-control" id="Pack" name="Pack" value="@product.Unit" readonly="readonly">
                                    </div>
                                </div>*@
                            <div class="form-group col-md-12" style="height: 1px;"></div>
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">主料名称</label>
                                <div class="col-sm-9">
                                    @if (tmView != null && isAdd == "0")
                                    {
                                        <input type="hidden" id="MaterialId" name="MaterialId" value="@tmView.MaterialId" />
                                        <span class="btn btn-primary showProList" id="materialName" style="margin-top: 5px;">@tmView.ProductName</span>
                                    }
                                    else
                                    {
                                        <input type="hidden" id="MaterialId" name="MaterialId" value="" />
                                        <span class="btn btn-primary showProList" id="materialName" style="margin-top: 5px;">选择原材料</span>
                                    }
                                </div>
                            </div>
                            <div class="form-group col-md-12" style="height: 1px;"></div>

                            @if (tmView != null && isAdd == "0")
                            {
                                <input type="hidden" id="jsonMaterialIdsData" name="jsonMaterialIdsData" value="@tmView.MaterialIdsData">
                                <input type="hidden" id="Id" name="Id" value="@tmView.Id" />
                                <input type="hidden" id="CreateTime" name="CreateTime" value="@tmView.CreateTime" />
                                <input type="hidden" id="eType" value="@tmView.EquipmentType" />
                                <input type="hidden" id="tType" value="@tmView.TechType" />
                                <div id="json-content">
                                    <div class="form-group col-md-6">
                                        <label class="col-sm-3 control-label">设备</label>
                                        <div class="col-sm-9">
                                            <select class="form-control" type="select" data-des="设备" id="EquipmentType" name="EquipmentType">
                                                <option value="0">==请选择==</option>
                                                @if (listEquipments != null)
                                                {
                                                    foreach (var item in listEquipments)
                                                    {
                                                        <option value="@item.Id">@item.EquipmentName</option>
                                                    }
                                                }
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label class="col-sm-3 control-label">类别</label>
                                        <div class="col-sm-9">
                                            <select class="form-control" type="select" data-des="类别" id="TechType" name="TechType">
                                                @if (levelList != null)
                                                {
                                                    foreach (var item in levelList)
                                                    {
                                                        <option value="@item.TechTypeId">@item.TechTypeName</option>
                                                    }
                                                }
                                                else
                                                {
                                                    <option value="0" selected="selected">==请选择==</option>
                                                }
                                            </select>
                                        </div>
                                    </div>


                                </div>
                                <div class="form-group col-md-12" style="height: 1px;"></div>
                            }
                            else
                            {
                                <input type="hidden" id="jsonMaterialIdsData" name="jsonMaterialIdsData" value="">
                                <div id="json-content">
                                    <div class="form-group col-md-6">
                                        <label class="col-sm-3 control-label">设备</label>
                                        <div class="col-sm-9">
                                            <select class="form-control" type="select" data-des="设备" id="EquipmentType" name="EquipmentType">
                                                <option value="0" selected="selected">==请选择==</option>
                                                @if (listEquipments != null)
                                                {
                                                    foreach (var item in listEquipments)
                                                    {
                                                        <option value="@item.Id">@item.EquipmentName</option>
                                                    }
                                                }
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label class="col-sm-3 control-label">类别</label>
                                        <div class="col-sm-9">
                                            <select class="form-control" type="select" data-des="类别" id="TechType" name="TechType">
                                                <option value="0" selected="selected">==请选择==</option>
                                                <option value="1">1类</option>
                                                <option value="2">2类</option>
                                                <option value="3">3类</option>
                                                <option value="4">4类</option>
                                                <option value="5">5类</option>
                                            </select>
                                        </div>
                                    </div>
                                    @*<div class="form-group col-md-6">
                                            <label class="col-sm-3 control-label">刀模数[左右]</label>
                                            <div class="col-sm-9">
                                                <input type="text" data-des="刀模数[左右]" class="form-control okeydown" id="Ch" name="Ch" value="" required>
                                            </div>
                                        </div>
                                        <div class="form-group col-md-6">
                                            <label class="col-sm-3 control-label">刀模数[排]</label>
                                            <div class="col-sm-9">
                                                <input type="text" data-des="刀模数[排]" class="form-control okeydown" id="Cv" name="Cv" value="" required>
                                            </div>
                                        </div>*@

                                </div>
                                <div class="form-group col-md-12" style="height: 1px;"></div>
                            }
                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">辅料名称</label>
                                <div class="col-sm-9">
                                    <span class="btn btn-primary showProListBox" style="margin-top: 5px;">请选择</span>
                                </div>
                            </div>
                            <div class="form-group col-md-12" style="height: 1px;"></div>

                            <div class="form-group col-md-6">
                                <label class="col-sm-3 control-label">&nbsp;</label>
                                <div class="col-sm-9">
                                    <ul class="todo-list ui-sortable" id="ui-sortable">
                                        @if (prosList != null)
                                        {
                                            foreach (var item in prosList)
                                            {
                                                <li class='li-content-@item.Id' data-id="@item.Id">
                                                    <span class='text' style='display: block'>名称：@item.Name</span>
                                                    <span class='text' style='display: block'>单位：@item.Unit</span>
                                                    <span class='text' style='display:block'>价格：@item.Price</span>
                                                    <small class="label">&nbsp;</small>
                                                    <div class="tools" style='display:block' onclick='remove(this)'>
                                                        <i class="fa fa-trash-o"></i>
                                                    </div>
                                                </li>
                                            }
                                        }
                                        @*<li>
                                                   todo Text
                                                <span class="text">Design a nice themeDesign a nice themeDesign a nice themeDesign a nice theme</span>
                                                <small class="label"> label-danger <i class="fa fa-clock-o"></i>2 mins </small>
                                                <div class="tools">
                                                    <i class="fa fa-trash-o"></i>
                                                </div>
                                            </li>*@
                                    </ul>
                                </div>
                            </div>
                            <div class="form-group col-md-12" style="height: 1px;"></div>

                        </div>
                        <div class="box-footer" style="width: 80%; margin-left: 20px;">
                            @if (isAdd == "1")
                            {
                                <a role="button" href="javascript:void(0)" class="btn btn-primary submitbtn" onclick="formsubmit(1)">添加</a>
                            }
                            else
                            {
                                <a role="button" href="javascript:void(0)" class="btn btn-primary submitbtn" onclick="formsubmit(2)">修改</a>
                            }
                            <a class="btn btn-primary submitbtn" href="@Url.Action("Service", "Technology")">返回</a>
                        </div>
                    </form>
                }
            </div>
        </div>
    </div>
</section>
<div class="modal" id="proTableList" style="display: none">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">选择主料</h4>
            </div>
            <div class="modal-body" style="height: 450px; overflow: hidden;overflow-y: scroll">
                <div class="col-md-6" style="margin-bottom: 15px;">
                    <div class="input-group">
                        <input id="filter" type="search" aria-controls="footable" class="form-control form-control-static" placeholder="请输入要查询关键字">
                    </div>
                </div>
                <div id="tableList">
                    @if (proList != null)
                    {
                        <table class="footable table table-stripped table-bordered table-hover" id="footable" data-page-size="99999" data-filter=#filter>
                            @*data-page-size="200"*@
                            <thead>
                                <tr>
                                    <th data-sort-ignore="true">
                                        主料名称
                                    </th>
                                    @*<th data-hide="phone,tablet" data-sort-ignore="true">
                                            产品编号
                                        </th>*@
                                    <th data-sort-ignore="true">
                                        选择
                                    </th>
                                </tr>
                            </thead>
                            <tbody class="checkboxs">
                                @if (null != Model)
                                {
                                    int count = 0;
                                    foreach (var item in proList)
                                    {
                                        <tr>
                                            <td>
                                                @Html.DisplayFor(modelItem => item.Name)
                                            </td>
                                            @*<td>
                                                    @Html.DisplayFor(modelItem => item.Number)
                                                </td>*@
                                            <td>
                                                <label>
                                                    @*<input type="checkbox" class="minimal pull-right" date-num="@count" data-proid="@item.Id" data-proname="@item.Name">*@
                                                    <input type="radio" class="minimal pull-right minimalRadio" name="radio" data-proid="@item.Id" data-proname="@item.Name">
                                                </label>
                                            </td>
                                        </tr>
                                        count++;
                                    }
                                }
                            </tbody>
                        </table>
                    }
                </div>
            </div>
            <div class="modal-footer">
                <a role="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</a>
                <a role="button" class="btn btn-primary" data-dismiss="modal">完成</a>
            </div>
        </div>
    </div>
</div>


<div class="modal" id="proTableListBox" style="display: none">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">选择辅料</h4>
            </div>
            <div class="modal-body" style=" height: 450px; overflow: hidden;overflow-y: scroll">
                <div class="col-md-6" style="margin-bottom: 15px;">
                    <div class="input-group">
                        <input id="filterBox" type="search" aria-controls="footable" class="form-control form-control-static" placeholder="请输入要查询关键字">
                    </div>
                </div>
                <div id="tableListBox">
                    @if (mateList != null)
                    {
                        <table class="footable table table-stripped table-bordered table-hover" id="footableBox" data-page-size="99999" data-filter=#filterBox>
                            <thead>
                                <tr>
                                    <th data-sort-ignore="true">
                                        名称
                                    </th>
                                    @*<th data-hide="phone,tablet" data-sort-ignore="true">
                                            产品编号
                                        </th>*@
                                    <th data-sort-ignore="true">
                                        选择
                                    </th>
                                </tr>
                            </thead>
                            <tbody class="checkboxs">
                                @if (null != Model)
                                {
                                    int count = 0;
                                    foreach (var item in mateList)
                                    {
                                        <tr>
                                            <td>
                                                @Html.DisplayFor(modelItem => item.Name)
                                            </td>
                                            @*<td>
                                                    @Html.DisplayFor(modelItem => item.Number)
                                                </td>*@
                                            <td>
                                                <label>
                                                    <input type="checkbox" class="minimal pull-right minimalBox" date-num="@count" data-proid="@item.Id" data-proname="@item.Name" data-proprice="@item.Price" data-prounit="@item.Unit">
                                                    @*<input type="radio" class="minimal pull-right" name="radio" data-proid="@item.Id" data-proname="@item.Name">*@
                                                </label>
                                            </td>
                                        </tr>
                                        count++;
                                    }
                                }
                            </tbody>
                        </table>
                    }
                </div>
            </div>
            <div class="modal-footer">
                <a role="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</a>
                <a role="button" class="btn btn-primary" data-dismiss="modal">完成</a>
            </div>
        </div>
    </div>
</div>


<div id="loadingPage" style="display: none;">
    <div class="loading-shade"></div>
    <div class="loading-content" onclick="$.loading(false)">数据加载中，请稍后…</div>
</div>

@section Scripts{
    <script type="text/javascript">
        var jsonData = { WebCheckbox: {} };
        jsonData.WebCheckbox.Ids = [];

        $(document).ready(function () {
            $('#footable').footable();
            $('#footableBox').footable();

            $("#frmedit").validate({
                submitHandler: function (form) {
                    var postData = $(form).formSerialize();
                    postData.Data = getParam(); //JSON.stringify(postData._Data);
                    postData.Type = type;
                    postData.ItemIds = JSON.stringify(jsonData.WebCheckbox.Ids);
                    $.submitForm({
                        url: $(form).attr("action"),
                        param: postData,
                        success: function () {
                            //$.reload();
                            $.modalAlert("操作成功", "success");
                            window.location.href = '@Url.Action("Service", "Technology")';
                        }
                    });
                }
            });

            var hidWorkType = $("#hidWorkType").val();
            $("#WorkType").val(hidWorkType);
            var isadd = $("#isAdd").val();
            if (isadd != "" && isadd == "0") {
                var jsonMaterialIdsData = $("#jsonMaterialIdsData").val();
                var etype = $("#eType").val();
                var ttype = $("#tType").val();
                $("#EquipmentType").val(etype);
                $("#TechType").val(ttype);
                if (jsonMaterialIdsData != "") {
                    var dataIds = JSON.parse(jsonMaterialIdsData);
                    dataIds.forEach(function (e, i) {
                        jsonData.WebCheckbox.Ids.push(e);
                    });
                }
                console.log(jsonData.WebCheckbox.Ids);
            }
        });

        var type = 1;

        function formsubmit(t) {
            var mid = $("#MaterialId").val();
            if (mid == "") {
                $.modalAlert("请选择原材料", "warning");
                return false;
            }
            var etype = $("#EquipmentType").val();
            var ttype = $("#TechType").val();
            if (etype == "0") {
                $.modalAlert("请选择设备", "warning");
                return false;
            }
            if (ttype == "0") {
                $.modalAlert("请选择类别", "warning");
                return false;
            }

            /*var len = jsonData.WebCheckbox.Ids.length;
            if (len == 0) {
                $.modalAlert("请选择辅料", "warning");
                return false;
            }*/

            if (jsonData.WebCheckbox.Ids.indexOf(mid) > -1) {
                $.modalAlert("主料和辅料不可有相同的材料", "warning");
                return false;
            }

            type = t;
            $("#frmedit").submit();
        }


        $(".showProList").click(function () {
            //$("#proList").modal();
            $("#proTableList").modal();
        });
        $(".showProListBox").click(function () {
            //$("#proList").modal();
            $("#proTableListBox").find("input[type='checkbox']").each(function (i, e) {
                if (jsonData.WebCheckbox.Ids.indexOf($(e).attr("data-proId")) > -1) {
                    $(e).iCheck('check');
                } else {
                    $(e).iCheck('uncheck');
                }
            });
            $("#proTableListBox").modal();
        });

        //iCheck for checkbox and radio inputs
        $('input[type="checkbox"].minimal,input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });

        //单选
        $('input[type="radio"].minimalRadio').on('ifChecked', function (event) {
            var proId = $(this).attr("data-proId");
            var proName = $(this).attr("data-proName");
            $("#materialName").text(proName);
            $("#MaterialId").val(proId);
            //alert(proId + ' proId' + proName + ' proName');
        });


        //多选选中
        $('input[type="checkbox"].minimalBox').on('ifClicked', function (event) {
            var proId = $(this).attr("data-proId");
            var proName = $(this).attr("data-proName");
            var proPrice = $(this).attr("data-proPrice");
            var proUnit = $(this).attr("data-proUnit");

            //现在判断时若是选中的，点击完了就变成了未选中了
            if ($(this).is(":checked")) {
                jsonData.WebCheckbox.Ids.splice($.inArray(proId, jsonData.WebCheckbox.Ids), 1); //删除对应的Id'
                $(this).removeClass("checkboxitem");
                $("#ui-sortable").find(".li-content-" + proId).remove();
            } else //这里判断是没选中，点击完了就变成选中了
            {
                if (jsonData.WebCheckbox.Ids.indexOf(proId) <= -1) {
                    var phtml = [];
                    phtml.push("<li class='li-content-" + proId + "' data-id='" + proId + "'><span class='text' style='display:block'>名称：" + proName + "</span>");
                    phtml.push("<span class='text' style='display:block'>单位：" + proUnit + "</span>");
                    phtml.push("<span class='text' style='display:block'>价格：" + proPrice + "</span>");
                    phtml.push("<small class='label'>&nbsp;</small><div class='tools' style='display:block'onclick='remove(this)'><i class='fa fa-trash-o' ></i></div></li>");
                    $("#ui-sortable").append(phtml.join(""));
                    $(this).addClass("checkboxitem");
                    jsonData.WebCheckbox.Ids.push(proId); //添加对应的Id'
                } else {
                    $.modalAlert("材料不可重复", "warning");
                    return false;
                }
            }
            console.log(jsonData.WebCheckbox.Ids);
            //$(".checkboxs").find('.checkboxitem').each(function (r) {
            //    var $this1 = $(this);
            //    var _name = $this1.attr('data-proName');
            //    phtml += "<span class='btn btn-primary' style='margin-left:5px;margin-top:5px;'>" + _name + "</span>";
            //});
            //$("#PurchaseNameId").val(jsonData.WebCheckbox.Ids);
            //console.log(jsonData.WebCheckbox.Ids);
        });

        function remove(obj) {
            var $this = $(obj);
            jsonData.WebCheckbox.Ids.splice($.inArray($this.parent().attr("data-id"), jsonData.WebCheckbox.Ids), 1); //删除对应的Id'
            $this.parent().remove();
            console.log(jsonData.WebCheckbox.Ids);
        }


        $(".okeydown").on("keydown", function () {
            var k = event.keyCode;
            if ((k <= 57 && k >= 48) || (k <= 105 && k >= 96) || (k == 8) || (k == 110) || (k == 190)) {
                return true;
            } else {
                return false;
            }
        });

        function getParam() {
            var postdata = [];
            //主键
            $("#json-content").find('input,select,textarea').each(function (r) {
                var $this = $(this);
                var id = $this.attr('id');
                var type = $this.attr('type');
                if (id) {
                    switch (type) {
                        case "checkbox":
                            postdata.push({ des: $this.attr("data-des"), name: id, value: $this.is(":checked") });
                            break;
                        case "select":
                            var value = $this.find("option:selected").val() == "" ? null : $this.find("option:selected").val();
                            postdata.push({ des: $this.attr("data-des"), name: id, value: value });
                            break;
                        default:
                            var value = $this.val() == "" ? "&nbsp;" : $this.val();
                            postdata.push({ des: $this.attr("data-des"), name: id, value: value });
                            break;
                    }
                }
            });
            return JSON.stringify(postdata);
        }
        //$(document).on("change", "#EquipmentType", function () {
        $("#EquipmentType").change(function () {
            var selectVal = $(this).val();
            $.ajax({
                url: "/Technology/GetLevelList",
                type: "post",
                data: {
                    selectVal: selectVal
                },
                success: function (data) {
                    if (data && JSON.parse(data)) {
                        var list = JSON.parse(data);
                        console.log(list);
                        $("#TechType").html("");
                        var html = [];
                        if (list.length > 0) {
                            for (var i = 0; i < list.length; i++) {
                                html.push("<option value=" + list[i].TechTypeId + ">" + list[i].TechTypeName + "</option>");
                            }
                        } else {
                            html.push("<option value='0' selected='selected'>==请选择==</option>");
                        }
                        $("#TechType").html(html);
                    } else {
                        alert("暂无参数");
                    }
                },
                error: function (xhr, err, state) {
                    //alert("e");
                }
            });
        });

        $(".productinfo").click(function () {
            var mid = $(this).data('mid');
            var options = {
                id: null,
                title: '产品信息',
                width: "100%",
                height: "100%",
                url: "../Product/Info?PID=" + mid,
                shade: 0.3,
                btn: ['返回'],
                btnclass: ['btn btn-danger'],
                callBack: null
            }
            $.modalOpen(options);
        });
        @*//确认添加原材料
        $("#add").click(function () {
            var a = String($("#permissionTree").getCheckedNodesValue());
            var b = String($("#permissionTree").getCheckedNodes());
            $("#treespan").text(a);
            $("#Materials").val(b);
            $('#editDlg').modal("hide");
        });
        function initControl() {
            $("#permissionTree").treeview({
                height: 300,
                showcheck: true,
                url: "@Url.Action("GetPermissionTree", "Technology")"
            });
        }
        //显示原材料弹出框
        function create() {
            initControl();
            $('#editDlg').modal();
        }*@
    </script>
}